package week03.single;

/**
 * Created by zhangxiaokun on 2018/2/8.
 */
public enum Singleton04 implements MySingleton{     //不是 延迟加载
    instance {
        @Override
        public void doSomething(){
            System.out.println("---Singleton04.doSomething() run...");
        }
    };

    private Singleton04(){
        System.out.println("---Singleton04 is creat...");
    }

    public static MySingleton getInstance() {
        return Singleton04.instance;
    }

    public static void axx() {  //用于测试观察 实例是否延迟加载
        System.out.println("---Singleton04.axx() run...");
    }
}

interface MySingleton {
    public void doSomething();
}